<html>
  <head>
    <title>Library</title>
    <link href="style.css" rel="stylesheet" type="text/css">
  </head>
  
  <body>
  
  
<?php

include_once( 'conf.php');
include_once( 'includes/functions.php');



$library_index = getIndex (variable_get('lib_root'));

$l_letter = '';

foreach ($library_index as $author_path) {
  $author = basename ($author_path);
  $letter = $author[0];
  if ($l_letter !== $letter) {
    $letters[] = $letter;
  }
  $l_letter = $letter;
}

?>
<div class = "alphalist"><a name="top">
<?php

foreach ($letters as $ltr) {
  echo '<a href="#' . $ltr . '">' . $ltr . "</a>
       ";
}
?>

</a></div>
<?php

$l_letter = null;

foreach ($library_index as $author_path) {
  $author = basename ($author_path);
  $letter = $author[0];
  if ($l_letter !== $letter) {
    
	echo '<table style="width:100%;padding:0;margin:1em 0 0 0;border:0">
        <tr style="padding:0;margin:0;border:0">
            <th style="text-align:left;padding:0;margin:0;border:0"><a class="letter" name="' . $letter . '"></a>
                <span class = "letter">' . $letter . '</span>
            </th>
            <th style="text-align:right;">
                <a href="#top" class = "uplink">^</a>
            </th>
        </tr>
    </table>';
  }
    echo '<span class="author"><a href="body.php?author=' . strToHex ($author) . '" target="body">' . $author . '</a></span><br>
	     ';
  $l_letter = $letter;
}


?>

  </body>
</html>